package com.catfairy.product.controller;

import com.LiXingYe.api.ProductInterface;
import com.LiXingYe.model.ProductInfo;
import com.catfairy.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 猫大仙
 */
@Slf4j
@RestController
@RequestMapping("/product")
public class ProductController implements ProductInterface {

    @Autowired
    private ProductService productService;

    @RequestMapping("/{productId}")
    public ProductInfo getProductInfo(@PathVariable("productId") Integer productId) {
        log.info("productId:{}", productId);
        return productService.selectProductById(productId);
    }

    @RequestMapping("/p1")
    public String p1(Integer id){
        return "product-service 接收到参数:id+"+id;
    }
}
